<!-- reportingResults -->
<template>
    <div class="page">
        <!-- 导航栏 -->
        <div class="navBar" id='z'>
            <customNavBar :leftTetx=leftTetx :titleTest=titleTest></customNavBar>
        </div>
        <!-- 页面内容 -->
        <div class="content">
            <div class='top'></div>
            <div class='contbottom' @click="shareNow()">立即分享链接</div>
            <div class='progressc' @click="goReportingResulbh()">
                发送邀请海报
            </div>
        </div>
        <van-share-sheet v-model:show="showShare" :options="options"  @select="selectChange"/>
    </div>
</template>
<script lang="ts" setup name="reportshare">
import { useRouter, useRoute } from "vue-router"
import { Toast } from '/@/utils/Message';
import { onMounted } from "vue"
import { reactive, ref } from 'vue'
import customNavBar from "/src/components/NavBar/customNavBar.vue"
import viewReport from "../../assets/img/tast/jxs.png"
import rebNtiveBrige  from "../../request/reb_native_brige.ts"

const router = useRouter()
const route = useRoute()
const leftTetx = ref("")
const titleTest = ref("邀请客户")
let data = reactive({
   ...route.query
});
let  showShare = ref(false);
const goReportingResulbh = () => {
  router.push({ path: '/reportingResulbh', query: { shortUrl: data.shortUrl} })

}
let shareNow = () => {
  showShare.value = true
}
const options = [
      {
        name: '微信',
        icon: 'wechat',
      }
];
const selectChange = (option: any) => {
    // console.log(window.deviceUtils,'deviceUtils')
    const ICBCName  = navigator.userAgent.includes("ICBC-AXA-REB") || navigator.userAgent.includes("ICBC-AXA-EBT")
    if(ICBCName) {
        // rebNtiveBrige.reb(data.shortUrl, '保单检视', '让您享受更安心的保障' )
        (window as any).deviceUtils.shareWX('保单检视', '让您享受更安心的保障', data.shortUrl, '')
    } else {
        var obj = {
            method: 'ProfessionalShareBDJSXT',
            data: {
                fileUrl: data.shortUrl,
                // fileUrl: 'http://192.168.137.175:8080/policyReviewH5/reportshare',
                filetitle: '保单检视',
                subtitle: '让您享受更安心的保障'
            }
        }
        if(navigator.userAgent.indexOf("JinShiTong_iOS") !== -1){
            (window as any).webkit.messageHandlers.interactive.postMessage(obj);
        } else if (navigator.userAgent.indexOf("JinShiTong_Android")!== -1){ 
            //interactive 安卓端定义的类名 postMessage 安卓端定义的方法名
            (window as any).interactive.postMessage(JSON.stringify(obj))
        }
    }
}
</script>

<!-- less嵌套设置 -->
<style lang="less" scoped>
.page {
    background-color: #FFFFFF;
    height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    .content {
        width: 100%;
        overflow: hidden;
        padding-top: 68px;
        .top {
            width: 100%;
            // height: 495px;
            padding-top: 84%;
            background: url(../../assets/img/tast/share1.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }
        .contbottom {
            // width: 271px;
            width: 70%;
            max-width: 400px;
            height: 58px;
            font-weight: 500;
            margin: 0 auto;
            margin-top: -29px;
            color: #FFFFFF;
            // margin-left: 53px;
            line-height: 53px;
            text-align: center;
            // position: absolute;
            background: url(../../assets/img/tast/bottom.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }
        .progressc {
            width: 66%;
            max-width: 380px;
            height: 38px;
            font-weight: 500;
            margin: 0 auto;
            font-size: 14px;
            color: #298BF0;
            line-height: 38px;
            border-radius: 26px;
            border: 1px solid #298Bf0;
            background-color: rgba(25, 138, 250, 0.05);
            font-weight: 500;
            margin-top: 20px;
            text-align: center;
            letter-spacing: 1.3px;
        }
    }
}
:deep(.van-share-sheet__option) {
//   margin-left: 138px;
    margin: 0 auto;
}
</style>

